package com.jyh.service;


import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.servlet.ModelAndView;
import com.jyh.config.BaseAction;
import com.jyh.config.datasource.TargetDataSource;
import com.jyh.dbOrder.dao.RiskAditLoanDao;
import com.jyh.util.StringUtils;

@Service
public class RiskAditLoanService extends BaseAction {
	@Autowired
	private RiskAditLoanDao riskAditLoanDao; 
	
	/**
	 * 获取风控审核中页面数据
	 * @param request
	 * @param session
	 * @return
	 */
	@TargetDataSource(name = "ds1")
	public ModelAndView getRiskAdit(HttpServletRequest request, HttpSession session) {
		ModelAndView mv = new ModelAndView("loan/riskAdit");
		String userNO  = request.getParameter("userNO");
		String orderNO  = request.getParameter("orderNO");
		String orderTime1  = request.getParameter("orderTime1");
		String orderTime2  = request.getParameter("orderTime2");
		String sql = "select * from jyh_order t1 left join jyh_order_payment t2 on t1.orderNO=t2.orderNO "
				+ "left join jyh_loan_type t3 on t1.typeNO=t3.typeNO where 1=1";
		if (StringUtils.isNotNull(userNO)) {
			sql = sql + " and t1.userNO='" + userNO + "'";
		}
		if (StringUtils.isNotNull(orderNO)) {
			sql = sql + " and t1.orderNO='" + orderNO + "'";
		}
		if (StringUtils.isNotNull(orderTime1)) {
			sql = sql + " and t1.orderTime>='" + orderNO + "'";
		}
		if (StringUtils.isNotNull(orderTime2)) {
			sql = sql + " and t1.orderTime<='" + orderNO + "'";
		}
		List<Map<String, Object>> list = riskAditLoanDao.getList(sql);
		mv.addObject("list", list);
		return mv;
	}

}
